using Circus.CodeEditor;
using Circus.CodeEditor.Serialization;
using Circus.CodeEditor.TextSource;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace Circus.CodeEditor.Dialogs
{
	public class SearchSettings : PersistentSettings
	{
		private IList<string> searchList;
		private IList<string> replaceList;
		private SearchOptions searchOptions;
		private bool clearBookmarks;
		private bool optionsVisible;
		private bool globalSearch;
		public virtual SearchOptions SearchOptions
		{
			get
			{
				return this.searchOptions;
			}
			set
			{
				if (this.searchOptions != value)
				{
					this.searchOptions = value;
					this.OnSearchOptionsChanged();
				}
			}
		}
		public virtual bool OptionsVisible
		{
			get
			{
				return this.optionsVisible;
			}
			set
			{
				if (this.optionsVisible != value)
				{
					this.optionsVisible = value;
					this.OnOptionsVisibleChanged();
				}
			}
		}
		public virtual bool ClearBookmarks
		{
			get
			{
				return this.clearBookmarks;
			}
			set
			{
				if (this.clearBookmarks != value)
				{
					this.clearBookmarks = value;
					this.OnClearBookmarksChanged();
				}
			}
		}
		public virtual IList<string> SearchList
		{
			get
			{
				return this.searchList;
			}
		}
		public virtual IList<string> ReplaceList
		{
			get
			{
				return this.replaceList;
			}
		}
		public bool GlobalSearch
		{
			get
			{
				return this.globalSearch;
			}
			set
			{
				this.globalSearch = value;
			}
		}
	
		public SearchSettings()
		{
			this.searchList = new List<string>();
			this.replaceList = new List<string>();
			this.searchOptions = EditConsts.DefaultSearchOptions;
		}
		private void CopyList(IList<string> fromList, IList<string> toList)
		{
			toList.Clear();
			foreach (string current in fromList)
			{
				toList.Add(current);
			}
		}
		protected virtual void OnSearchOptionsChanged()
		{
		}
		protected virtual void OnClearBookmarksChanged()
		{
		}
		protected virtual void OnOptionsVisibleChanged()
		{
		}
		public override void Assign(PersistentSettings source)
		{
			if (source is SearchSettings)
			{
				this.Assign((SearchSettings)source);
			}
		}
		public virtual void Assign(SearchSettings source)
		{
			this.CopyList(source.SearchList, this.searchList);
			this.CopyList(source.ReplaceList, this.replaceList);
			this.searchOptions = source.SearchOptions;
		}
		
	}
}
